package cn.kgc.ssmmodulardemo.service.impl;

import cn.kgc.ssmmodulardemo.dao.UserMapper;
import cn.kgc.ssmmodulardemo.entity.User;
import cn.kgc.ssmmodulardemo.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    public User UserLogin(User user) {

        List<User> userList=userMapper.queryAll();
        User result=null;
        for (User user1:userList
             ) {
            if ((user1.getUserName().equals(user.getUserName()) && (user1.getUserPassword().equals(user.getUserPassword())))){
                result =user1;
                break;
            }
        }
        return result;
    }
}
